﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TileEngine
{
    class PopupText
    {
        Color color;
        string text;
        public int frame=0;
        Vector2 position;
        public PopupText(Color color,string text,Vector2 position)
        {
            this.position = position;
            this.color = color;
            this.text = text;
        }
        public void draw(SpriteBatch spriteBatch)
        {
            position.Y--;
            if(frame<110)
            frame++;
            if (frame < 5)
            {
                spriteBatch.DrawString(Textures.font10Bold, text, position, color, 0, new Vector2(0, 0), ((float)frame / 5), SpriteEffects.None, 0);
            }
            else if( frame < 100)
            {
                spriteBatch.DrawString(Textures.font10Bold, text, position, color, 0, new Vector2(0, 0),1, SpriteEffects.None, 0);
            }
            else if( frame <105)
                spriteBatch.DrawString(Textures.font10Bold, text, position, color, 0, new Vector2(0, 0), (1-(float)(frame-100)/5), SpriteEffects.None, 0);
            
        }
    }
}
